<!DOCTYPE html>
<html ng-app="myApp">
	<head>
		<meta charset="utf-8">
		<title></title>
		<script src="js/angular.js"></script>
	</head>
	<body ng-controller="showtest">
		<form action="" method="post" ng-submit="toggle()">
			
	
	<div id="a" ng-show="isShow" is-show="canedit">
		sssss
	</div>
		<div id="a" ng-hide="isShow" is-show="canedit">
		ppppp
	</div>
	
			<input type="submit" value="切换" />
		</form>
		<script>
			angular.module('myApp',[])
			.controller('showtest',function($scope){
				//$scope.canedit=true;
				$scope.toggle=function(){
					//$scope.canedit=!$scope.canedit; //在函数中这样不行？？？？不在函数中是可以的
					$scope.isShow=!$scope.isShow;
				}
			})
			.directive('myShow',function(){
				return{
					scope:{
						'isShow':'='
					}
				}
			})
		</script>
	</body>
</html>
